<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{$title}</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="/static/index/amazeui/css/amazeui.min.css"/>
<link rel="stylesheet" href="/static/index/default/style.css"/>
<script src="/static/index/amazeui/js/jquery.min.js"></script>
<script src="/static/index/amazeui/js/amazeui.min.js"></script>
<link href="/static/css/font-awesome.css?v=4.4.0" rel="stylesheet">
<link href="/static/css/animate.css" rel="stylesheet">

<link rel="stylesheet" href="/static/index/js/layer/mobile/need/layer.css" />
<script src="/static/index/js/layer/mobile/layer.js"></script>


</head>

<body>
<div class="container">
	<!-- 引入头文件 -->
	{include file="common/header" /}

    <div data-am-widget="tabs" class="am-tabs am-tabs-d2">
		<ul class="am-tabs-nav am-cf">
			<li class="am-active">
				<a href="[data-tab-panel-0]">我的资料</a>
			</li>
			<li class="">
				<a href="[data-tab-panel-1]">修改密码</a>
			</li>
		</ul>
		<div class="am-tabs-bd am-accordion-content">
			<div data-tab-panel-0 class="am-tab-panel am-active">
				<form id="zlForm" class="am-form am-accordion-content" data-am-validator>
					{if condition="$Think.session.indexUserInfo.type == 1"}
	            		<div class="am-form-group am-form-icon">
				        	<i class="am-icon-tag" style="color:#329cd9"></i>
				        	<input type="text" name="work_number" class="am-form-field  my-radius" value="{$Think.session.indexUserInfo.work_number}" placeholder="请输入工号" required>
				        </div>
				        <div class="am-form-group am-form-icon">
				        	<i class="am-icon-user" style="color:#329cd9"></i>
				        	<input type="text" name="name" class="am-form-field  my-radius" value="{$Think.session.indexUserInfo.name}" placeholder="请输入姓名" required>
				        </div>
				         <div class="am-form-group am-form-icon">
				        	<!--<i class="am-icon-user" style="color:#329cd9"></i>-->
				        	<label style="display: inline-block; margin-right: 10px;">
				        		<input type="radio" name="sex" id="nan"  value='0'> 男
				        	</label>
				        	<label>
				        		<input type="radio" name="sex" id="nv"  value='1'> 女
				        	</label>
                            
				        </div>
				        <div class="am-form-group am-form-icon">
				        	<i class="am-icon-phone" style="color:#f09513"></i>
				        	<input type="text" name="tel" class="am-form-field  my-radius" value="{$Think.session.indexUserInfo.tel}" placeholder="请输入联系电话" required>
				        </div>
				         <div class="am-form-group am-form-icon">
				        	<i class="am-icon-graduation-cap" style="color:#f09513"></i>
				        	<input type="text" name="duty" class="am-form-field  my-radius" value="{$Think.session.indexUserInfo.duty}" placeholder="请输入职务" required>
				        </div>
				        <div class="am-form-group am-form-icon">
				        	 <i class="am-icon-graduation-cap" style="color:#e88888"></i>
				        	 <select id="dept_id" name="dept_id" style="padding-left: 9%;" required>
						        <option value="">请选择学院</option>
						        <option value="1">软件与计算机学院</option>
						        <option value="2">管理学院</option>
						        <option value="3">电子信息学院</option>
						        <option value="4">传媒学院</option>
						     </select>
				        </div>
				        <div class="am-form-group am-form-icon">
				        	<textarea name="note" rows="3" cols="" placeholder="请简单的说明一下你自己哦">{$Think.session.indexUserInfo.note}</textarea>
				        </div>
				        
					{else /}
						<div class="am-form-group am-form-icon">
				        	<i class="am-icon-tag" style="color:#329cd9"></i>
				        	<input type="text" name="student_number" class="am-form-field  my-radius" value="{$Think.session.indexUserInfo.student_number}" placeholder="请输入学号" required>
				        </div>
				        <div class="am-form-group am-form-icon">
				        	<i class="am-icon-user" style="color:#329cd9"></i>
				        	<input type="text" name="name" class="am-form-field  my-radius" value="{$Think.session.indexUserInfo.name}" placeholder="请输入姓名" required>
				        </div>
				        <div class="am-form-group am-form-icon">
				        	<i class="am-icon-phone" style="color:#f09513"></i>
				        	<input type="text" name="tel" class="am-form-field  my-radius" value="{$Think.session.indexUserInfo.tel}" placeholder="请输入联系电话" required>
				        </div>
				        <div class="am-form-group am-form-icon">
				        	 <i class="am-icon-graduation-cap" style="color:#e88888"></i>
				        	 <select id="dept_id" name="dept_id" style="padding-left: 9%;" required>
						        <option value="">请选择学院</option>
						        <option value="1">软件与计算机学院</option>
						        <option value="2">管理学院</option>
						        <option value="3">电子信息学院</option>
						        <option value="4">传媒学院</option>
						     </select>
				        </div>
				        <div class="am-form-group am-form-icon">
				        	 <i class="am-icon-graduation-cap" style="color:#e88888"></i>
				        	 <select id="specialty" name="specialty" style="padding-left: 9%;" required>
						        <option value="">请选择专业</option>
						        <option value="软件工程">软件工程</option>
						        <option value="市场营销">市场营销</option>
						        <option value="物联网工程">物联网工程</option>
						        <option value="动漫设计">动漫设计</option>
						     </select>
				        </div>
				        <div class="am-form-group am-form-icon">
				        	 <i class="am-icon-graduation-cap" style="color:#e88888"></i>
				        	 <select id="clazz_id" name="clazz_id" style="padding-left: 9%;" required>
						        <option value="">请选择班级</option>
						        <option value="1">java1</option>
						        <option value="2">java4</option>
						     </select>
				        </div>
				      
					{/if}
		          
			        <div class="am-form-group ">
			        	<input type="button" class="am-btn am-btn-success  my-radius okBtn" value="修 改"/>
			        	<!--<input type="reset" class="am-btn am-btn-default  my-radius" value="重 置"/>-->
			        </div>
		          </form>
			</div>
			<div data-tab-panel-1 class="am-tab-panel am-accordion-content">
	          	<form  id="xgmmForm" class="am-accordion-content" data-am-validator>
		          	<div class="am-form-group am-form-icon">
			        	<i class="am-icon-lock" style="color:#329cd9"></i>
			        	<input type="password" class="am-form-field  my-radius" 
			        		minlength="6" maxlength="16" name="oldpassword" placeholder="请输入原始密码" required>
			        </div>
			        <div class="am-form-group am-form-icon">
			        	<i class="am-icon-lock" style="color:#329cd9"></i>
			        	<input type="password" class="am-form-field  my-radius" 
			        		minlength="6" maxlength="16" name="password" placeholder="请输入新密码" required>
			        </div>
			        <div class="am-form-group ">
			        	<input type="button" class="am-btn am-btn-success  my-radius okBtn1" value="修 改"/>
			        	<input type="reset" class="am-btn am-btn-default  my-radius" value="重 置"/>
			        </div>
		          </form>
			</div>

		</div>
	</div>
    <footer data-am-widget="footer" class="am-footer am-footer-default" data-am-footer="{  }">
	    <hr data-am-widget="divider" style="" class="am-divider am-divider-default"/>
	  <div class="am-footer-miscs ">
	    <p>CopyRight©2014 AllMobilize Inc.</p>
	    <p>京ICP备13033158</p>
	  </div>
	</footer>
    <!-- 引入底部文件 -->
	<!--<include src="footer.html"></include>-->
	<!-- 引入头部文件end -->
</div>
<script src="/static/js/plugins/layer/layer.min.js"></script>
<script>

	$(function(){
		if('{$Think.session.indexUserInfo.sex}' == 0){
			$("#nan").attr("checked","checked");
		}else{
			$("#nv").attr("checked","checked");
		}
		$("#dept_id").find("option[value='{$Think.session.indexUserInfo.dept_id}']").attr("selected",true);
		$("#specialty").find("option[value='{$Think.session.indexUserInfo.specialty}']").attr("selected",true);
		$("#clazz_id").find("option[value='{$Think.session.indexUserInfo.clazz_id}']").attr("selected",true);
		
	})
	
	//修改个人资料
	$(".okBtn").click(function(){
		$.ajax({
            url: "/index/user/updateUserInfoPost",
            data:  $("#zlForm").serialize(),
            type: "POST",
            dataType: 'json',
            success: function(data){
            	console.log(data)
               if (data.success) {
                    parent.layer.msg(data.msg, {icon: 6});
                } else {
                    parent.layer.msg(data.msg, {icon:5});
                }
            }
        });
	})
	
	//修改密码
	$(".okBtn1").click(function(){
		if($("input[name = 'password']").val() == $("input[name = 'oldpassword']").val()){
			parent.layer.msg('新密码与原始密码不能相同', {icon: 6});
			return false
		}else{
			$.ajax({
	            url: "/index/user/updateUserPasswordPost",
	            data:  $("#xgmmForm").serialize(),
	            type: "POST",
	            dataType: 'json',
	            success: function(data){
	            	console.log(data)
	               if (data.success) {
	                    parent.layer.msg(data.msg, {icon: 6});
	                } else {
	                    parent.layer.msg(data.msg, {icon:5});
	                }
	            }
	        });
		}
		
	})
</script>
</body>
</html>
